﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace GroceryPriceBook.Core.ViewModel
{
	public class PurchaseLogItem
	{
		public PurchaseLogItem()
		{
			Product = new Product();
			Id = -1;
		}

		public System.Guid PurchaseId { get; set; }
		public int Id { get; set; }
		public System.Guid ProductId { get; set; }

		[DisplayName("Discount?")]
		public bool IsDiscount { get; set; }

		[Range(1, int.MaxValue, ErrorMessage = "Please enter a valid number")]
		[Required(ErrorMessage = "Required")]
		public int Quantity { get; set; }

		[DisplayName("Price")]
		public decimal Price { get; set; }

		[DisplayName("Price Per Item")]
		public decimal PricePerItem { get; set; }

		public string ProductAmountUnitTotal { get; set; }

		[DisplayName("Price Per Weight / Volume Unit")]
		public decimal PricePerAmountUnit { get; set; }

		[DisplayName("Price Per Count / Quantity Unit")]
		public decimal PricePerQuantityUnit { get; set; }

		[StringLength(300)]
		[DataType(DataType.MultilineText)]
		public string Note { get; set; }

		public Product Product { get; set; }
		public IEnumerable<SelectListItem> ProductSelectListItems { get; set; }
	}
}
